﻿using System.Collections.Generic;

namespace Pfz.Remoting.Udp
{
	/// <summary>
	/// Interface used by generic-purpose listeners.
	/// Such listeners requires that you configure them before calling TryAccept, but
	/// have a more generic approach than TcpListener.
	/// </summary>
	public interface IUdpConnectionListener<out T>:
		IAdvancedDisposable
	where
		T: IUdpConnection
	{
		/// <summary>
		/// Tries to accept a new connection or returns null if this object was disposed.
		/// </summary>
		T TryAccept();

		/// <summary>
		/// Enumerates all active connections of this listener.
		/// </summary>
		T[] GetConnections();
	}
}
